package com.xmb.common.controller.internal;

import com.xmb.common.entity.XmbSpreadRewardSetting;
import com.xmb.common.service.SpreadRewardSettingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by lyndon on 2019/4/10.
 */
@RestController
public class SpreadRewardController {

    @Autowired
    private SpreadRewardSettingService xmbSpreadRewardSettingService;

    /**
     * 增加营销配置信息
     * @param
     */
    @PostMapping(value = "saveXmbSpreadRewardSetting")
    public int saveXmbSpreadRewardSetting(@RequestBody XmbSpreadRewardSetting rewardSetting){
        return xmbSpreadRewardSettingService.saveXmbSpreadRewardSetting(rewardSetting);
    }

    /**
     * 根据activityid修改营销配置信息
     * @param
     */
    @PostMapping(value = "updateRewardSettingByActivityId")
    public int updateXmbSpreadRewardSetting(@RequestBody XmbSpreadRewardSetting rewardSetting){
        return xmbSpreadRewardSettingService.updateRewardSettingByActivityId(rewardSetting);
    }

    /**
     * 根据activityid删除营销配置信息
     * @param
     */
    @PostMapping(value = "/deleteXmbSpreadRewardSetting")
    public int deleteXmbSpreadRewardSetting(@RequestBody List<Long> activityIds){
        return xmbSpreadRewardSettingService.deleteRewardSettingByActivityIds(activityIds);
    }

    /**
     * 获取营销配置信息
     * @param
     */
    @PostMapping(value = "findXmbSpreadRewardSetting")
    public XmbSpreadRewardSetting findXmbSpreadRewardSetting(@RequestBody XmbSpreadRewardSetting rewardSetting){
        return xmbSpreadRewardSettingService.findXmbSpreadRewardSetting(rewardSetting);
    }
}
